package day08;

import java.util.ArrayList;
import java.util.Scanner;

public class ChooseSong {
    public static ArrayList<String> listSingers = new ArrayList<>();//歌手集合
    public static ArrayList<addListSingers> listSongNames = new ArrayList<>();//歌名集合
    public static ArrayList<addListSingers> listSongList = new ArrayList<>();//点播集合
    public static  Scanner scanner = new Scanner(System.in);//主入口
    public static void main(String[] args) {
        while (true) {
            System.out.println("------------欢迎来到点歌系统------------");
            System.out.println("1.选择你喜欢的歌手");
            System.out.println("2.查看已点播歌曲");//遍历并输出
            System.out.println("3.选择你想置顶歌曲");
            System.out.println("4.退出");
            System.out.println("请输入序号:");
            int choose = scanner.nextInt();
            switch (choose){
                case 1:
                    addListSingers();
                    addSongSingersChoose();
                    break;
//                case 2:
//                    addListSong();
//                    break;
//                case 3:
//                    addListSongBefore();
//                    break;
                case 4:
                    System.out.println("退出---------------");
                    System.out.println("您已退出系统");
                    return ;
            }
        }
   }
    //    ①创建集合  < 歌手集合
    public static void addListSingers(){
        listSingers.add("1.周杰伦");
        listSingers.add("2.林俊杰");
        listSingers.add("3.邓紫棋");
        listSingers.add("4.返回上一层");
        System.out.println(listSingers);
    }

    public static void addSongSingersChoose(){
        while (true) {
            System.out.println("请选择歌手名称:");
            int songer = scanner.nextInt();
            switch (songer) {
                case 1:
                    addListSingers();
                    break;
                case 2:
                    addListSingers();
                    break;
                case 3:
                    addListSingers();



                    break;
                case 4:
                    return;
            }
        }

   需要     public static void addListSingers(){
            System.out.println("请选择歌名名称:");
            String songName = scanner.next();
            addListSingers singer = new addListSingers();
            singer.setSingName(songName);
            for (int i = 0; i < listSongNames.size(); i++) {
                System.out.println(listSongNames.get(i));
            if (i >= 0 && i<listSongList.size()) {
                System.out.println("点播成功！");
            }else {
                return;
            }

        }
    }

    public static void addListSongNamesChoose(){
        while (true){
            System.out.println("请选择歌名名称:");
            String choose01 = scanner.next();
            if (choose01 == 1){
                listSongList.add(listSongNames.get(0));
                System.out.println("点播成功！");
            }else if (choose01 == 2){
                listSongList.add(listSongNames.get(1));
                System.out.println("点播成功！");
            }else if (choose01 == 3){
                listSongList.add(listSongNames.get(2));
                System.out.println("点播成功！");
            }else if (choose01 == 4){
                return;
            }
        }
    }
    public static void addListSong(){
        for (int i = 0; i < listSongList.size(); i++) {
            System.out.println(i + "----" + listSongList.get(i));
        }
        System.out.println(listSongList);
    }


    public static void addListSongBefore(){
        while (true) {
            System.out.println("请输入想前置的歌曲名称：");
            int index = scanner.nextInt();
            if (index >= 0 && index<listSongList.size()){
                addListSingers singNameBefore = listSongList.get(index);
                while (true){
                    if (index < 0) {
                        System.out.println("您输入的歌曲不在列表中！");
                    } else if (index == 0) {
                        System.out.println("您输入的歌曲已前置");
                    } else {
                        listSongList.remove(index);
                        listSongList.add(0,singNameBefore);
                        System.out.println("前置歌曲到第一个" + singNameBefore);
                        return;
                    }
                }
            }

        }
    }

}
//        ①创建集合  < 歌名集合
    public static void addListSongNames01(){
        listSongNames.add("1.《半岛铁盒》");
        listSongNames.add("2.《冻结》");
        listSongNames.add("3.《花海》");
        listSongNames.add();
        listSongNames.add("4.返回上一层");
        System.out.println(listSongNames);
    }

    public static void addListSongNames02(){
        listSongNames.add("1.《烟花易冷》");
        listSongNames.add("2.《修炼爱情》");
        listSongNames.add("3.《曹操》");
        listSongNames.add("4.返回上一层");
        System.out.println(listSongNames);
    }

    public static void addListSongNames03(){
        listSongNames.add("1.《泡沫》");
        listSongNames.add("2.《你把我灌醉》");
        listSongNames.add("3.《喜欢你》");
        listSongNames.add("4.返回上一层");
        System.out.println(listSongNames);
    }



            switch (choose02) {
                case 1:
                    addListSongNames01();
                    addListSongNamesChoose01();
                    break;
                case 2:
                    addListSongNames02();
                    addListSongNamesChoose01();
                    break;
                case 3:
                    addListSongNames03();
                    addListSongNamesChoose01();
                    break;
                case 4:
                    return;
            }





